Gaining Ultimate Control of Referencing

Recapping, we see that the command
Ref
basically does for references what
eqn
does for equations. Ordinarily,
Ref
is the most convenient version of the reference command and will be the one you will use most often. There will be situations, however, where you wish to generate a named reference without generating its reference mark. For example, you may be typing a formula, or a footnote and wish to put the superscripted reference mark inside the footnote or formula (or for that matter, inside some
hbox
which you are defining). You must be careful because the command
Ref
cannot be used in these situations. This has to do with the way in which it goes about doing its job. You really don't have to know the reasons why it won't work, you just have to know it won't. This problem is easily solved if you know how to use the most flexible form of the reference command; namely, the command
REF
junkname{ text }
As you see the syntax of this command is identical to
Ref
and in fact, it does almost exactly the same thing. It generates a dummy name (
junkname
) and writes the text material into the file referenc.texauxil. The difference is that when
REF
is finished it does not attach the reference mark to the preceding word. To attach the reference mark to a specific word you type the command
refend
immediately following that word. Basically, what
Ref
does is invoke the command
REF
immediately followed by the command
refend
. Dividing the reference generating command from the command which attaches the reference mark solves all of the aforementioned problems. If you wish to put a reference in a forbidden place, like a footnote, or hbox, or formula, all you have to do is use
REF
somewhere before you enter the forbidden territory and then use
refend
immediately following the place where you want the reference mark.